package com.heima.search.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.search.dtos.HistorySearchDto;
import com.heima.search.service.UserSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * APP用户搜索信息表 前端控制器
 * </p>
 *
 * @author itheima
 */
@RestController
@RequestMapping("/api/v1/history")
public class ApUserHistoryController {

    @Autowired
    private UserSearchService userSearchService;

    /**
     * 查询历史记录
     * @return
     */
    @PostMapping("/load")
    public ResponseResult findUserSearch() {
        return userSearchService.findUserSearchHistory();
    }

    /**
     * 删除历史记录
     * @param dto
     * @return
     */
    @PostMapping("/del")
    public ResponseResult delApUserSerachHistory(@RequestBody HistorySearchDto dto){
        return  userSearchService.delApUserSerachHistory(dto);
    }

}